/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.campaign.biz;

import com.aptech.campaign.dao.ProductDAO;
import com.aptech.campaign.entities.Product;
import java.util.ArrayList;

/**
 *
 * @author Tai Nguyen
 */
public class ProductBiz {

    ProductDAO dao = new ProductDAO();

    public ProductBiz() {
    }

    /**
     * add a new product
     * @param Product product
     * @return the boolean value
     */
    public boolean createProduct(Product product) {
        return dao.createProduct(product);
    }

    /**
     * edit information of product
     * @param int productID, String productName, float price, String info
     * @return the boolean value
     */
    public boolean storeProduct(int productID, String productName, float price, String info) {
        return dao.updateProduct(productID, productName, price, info);
    }

    /**
     * delete a product
     * @param int productID
     * @return the boolean value
     */
    public boolean removeProduct(int productID) {
        return dao.deleteProduct(productID);
    }

    /**s
     * get array of products in database
     * Param
     * @return ArrayList<Product>
     */
    public ArrayList<Product> findByAllProduct() {
        return dao.readByAllProduct();
    }

    /**
     * @return the lasterror
     */
    public String getLasterror() {
        return dao.getLasterror();
    }

    /**
     * @param lasterror the lasterror to set
     */
    public void setLasterror(String lasterror) {
        dao.setLasterror(lasterror);
    }
}
